package com.ohc.leetcode.字符串;

import java.util.HashMap;
import java.util.Map;

/**
 * 2022年5月11日14:31:01  暂时没写出来
 */
public class 重复的子字符串459 {

    public static boolean repeatedSubstringPattern(String s) {
        Map<Integer, Character> map = new HashMap<>();
        StringBuilder builder1 = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            builder1.append(s.charAt(i));
            if (i != 0) {
                StringBuilder builder2 = new StringBuilder();
                for (int j = i + 1; j < s.length(); j++) {
                    builder2.append(s.charAt(j));
                    if (builder1.length() == builder2.length() & builder1.equals(builder2)) {
                        return true;
                    } else {
                        builder1 = new StringBuilder();
                        builder2 = new StringBuilder();
                        break;
                    }
                }
            }
        }

        return false;
    }

    public static void main(String[] args) {
        String str = "abab";
        boolean flagf = repeatedSubstringPattern(str);
        System.out.println("flagf = " + flagf);
    }
}
